package com.tiance.demo.ui.property;

import com.tiance.demo.ui.ability.Draggable;
import javafx.scene.control.Label;
import javafx.scene.layout.*;
import javafx.scene.paint.Paint;
import javafx.scene.text.Font;

public class PagePropertyPane extends VBox {

    public PagePropertyPane() {
        this.setPrefWidth(480);
        this.setMinWidth(200);
        this.setBorder(new Border(new BorderStroke(Paint.valueOf("#663333"), BorderStrokeStyle.SOLID, new CornerRadii(0), new BorderWidths(0, 0, 0, 5))));

        Label fileHeader = new Label("FILE HEADER");
        fileHeader.setFont(Font.font(16));

        FileHeaderPropertyTable fileHeaderPropertyTable = new FileHeaderPropertyTable();

        Label pageHeader = new Label("PAGE HEADER");
        pageHeader.setFont(Font.font(16));

        PageHeaderPropertyTable pageHeaderPropertyTable = new PageHeaderPropertyTable();

        this.getChildren().addAll(fileHeader, fileHeaderPropertyTable, pageHeader, pageHeaderPropertyTable);

        setDraggable();
    }

    private void setDraggable() {
        Draggable draggable = new Draggable(Draggable.DRAG_LEFT);

        this.setOnMouseDragged(draggable);
        this.setOnDragDetected(draggable);
        this.setOnMouseDragReleased(draggable);
        this.setOnMouseReleased(draggable);
        this.setOnMouseEntered(draggable);
    }
}
